#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int dominantIndex(int* nums, int numsSize) {
    int Max=0, max=0;
    int Index=0;
    for (int i = 0; i < numsSize; i++) {
        if (nums[i] > Max)
        {
            Max = nums[i];
            Index = i;
        }
    }
    for (int i = 0; i < numsSize; i++) {
        if (nums[i] > max && i != Index)
        {
            max = nums[i];
        }
    }
    if (Max >= (2 * max))
        return Index;
    else
        return -1;
}
int main()
{
    int arr[4] = { 3,6,1,0 };
    printf("%d\n", dominantIndex(arr,4));
	return 0;
}